const app=getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    qrcode:''
  },
  save: function () {
    var _this=this;
    if (_this.data.qrcode == '') {
      wx.showToast({
        title: '请输入邀请码',
        icon:'none',
      });
    } else {
      wx.showLoading({
        title: '数据加载中...',
      })
      app.doReq(app.globalData.SERVICE.AUTH.SAVE, {
        "id": app.globalData.userid,
        "xgmember.code": _this.data.qrcode
      }, 'get',function (res) {
        console.log(res);
        wx.hideLoading();
        if (res.data.code == 200) {
            wx.showToast({
              title: '认证成功！',
              icon:'success',
              success:function(res){
                wx.navigateBack({})
              }
            })
        } else {
          wx.showToast({
            title: res.data.errmsg,
            icon:'none'
          });
        }
      });
    }
  },
  whenInput:function(e){
      this.data.qrcode = e.detail.value;
  },
  goPerson:function(){
    wx.switchTab({
      url: '../../pages/personal/personal'
    })
  
  },
  goBaseInfo:function(){
      wx.navigateTo({
        url: '../../pages/personalBaseInfoEdit/personalBaseInfoEdit',
      })
  },
  goMarriges:function(){
    wx.navigateTo({
      url: '../../pages/mateCondition/mateCondition',
    })
  },
  goPic:function(){
    wx.navigateTo({
      url: '../../pages/personalInfoEdit/personalInfoEdit'
    })
  }
})